package main

import (
	"core/component/logger"
	"core/gateway/logic"
	"core/ini"
	"core/logic/logicredis"
	"flag"
	"strconv"
)

var (
	processIdx = flag.Int("pidx", 1, "the same process number")
)

func main() {
	flag.Parse()

	ini.LoadCfg("conf.ini")

	logger.SetLogFile("gateway"+"_"+strconv.Itoa(*processIdx), "gateway")

	logger.SetLogLevel("DEBUG")

	if err := logicredis.InitRedisInstance(); err != nil {
		logger.Infof("InitRedisInstance Failed err=%v", err)
		return
	}
	logic.ServerInstance().Start(ini.CfgGetMe(), *processIdx)

	logger.Info("[停服] 关闭gateway服务器")

	logger.Flush()
}
